package com.pro.common.modules.service.dependencies.service;

import com.pro.framework.api.model.IModel;
import com.pro.framework.javatodb.config.JTDProperties;
import com.pro.framework.mtq.service.multiwrapper.entity.IMultiClassRelationService;
import com.pro.framework.mtq.service.multiwrapper.entity.SysMultiClassRelation;
import com.pro.framework.mtq.service.multiwrapper.util.MultiClassRelationFactory;
import com.pro.framework.spring.util.ClassScanner;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;

/**
 * ƒ
 * 服务实现类
 */
@Service
@Slf4j
public class BaseMultiClassRelationService implements IMultiClassRelationService<SysMultiClassRelation> {
    @Autowired
    private JTDProperties jtdProperties;

    @Override
    public List<SysMultiClassRelation> getRelations() {
        return Collections.emptyList();
    }

    @Override
    public Collection<Class<?>> loadClasses() {
        return new HashSet<>(ClassScanner.scanClasses(jtdProperties.getBasePackages(), IModel.class));
    }

    @Override
    public Class<?> getClass(String entityClassName) {
        return MultiClassRelationFactory.INSTANCE.getEntityClass(entityClassName);
    }
}
